package internal

import (
	"fmt"
	"io"
	"os"
	"time"
)

var (
	// DefaultExitFunc is the default exit function for all logger instances.
	DefaultExitFunc = os.Exit

	// EmptyExitFunc is the empty exit function for all logger instances.
	EmptyExitFunc = func(int) {}

	// DefaultPanicFunc is the default panic function for all logger instances.
	DefaultPanicFunc = func(s string) { panic(s) }

	// EmptyPanicFunc is the empty panic function for all logger instances.
	EmptyPanicFunc = func(string) {}

	// DefaultNowFunc is the default now function for all logger instances.
	DefaultNowFunc = time.Now

	// DefaultTimeFormat is the default time format for all logger instances.
	DefaultTimeFormat = time.RFC3339

	// DefaultCallerReporter is the default caller for all logger instances.
	DefaultCallerReporter = new(CallerReporter)

	// ErrorWriter is used to output logger internal error messages.
	ErrorWriter io.Writer = os.Stderr
)

// EchoError writes the given logger internal error message to ErrorWriter.
func EchoError(format string, args ...interface{}) {
	_, _ = fmt.Fprintln(ErrorWriter, fmt.Sprintf(format, args...))
}
